package org.apache.harmony.javax.security.auth.login;

import org.apache.harmony.javax.security.auth.AuthPermission;

public abstract class Configuration
{
  private static final AuthPermission GET_LOGIN_CONFIGURATION = new AuthPermission("getLoginConfiguration");
  private static final String LOGIN_CONFIGURATION_PROVIDER = "login.configuration.provider";
  private static final AuthPermission SET_LOGIN_CONFIGURATION = new AuthPermission("setLoginConfiguration");
  private static Configuration configuration;

  // ERROR //
  static Configuration getAccessibleConfiguration()
  {
    // Byte code:
    //   0: getstatic 37	org/apache/harmony/javax/security/auth/login/Configuration:configuration	Lorg/apache/harmony/javax/security/auth/login/Configuration;
    //   3: astore_0
    //   4: aload_0
    //   5: ifnonnull +36 -> 41
    //   8: ldc 2
    //   10: monitorenter
    //   11: getstatic 37	org/apache/harmony/javax/security/auth/login/Configuration:configuration	Lorg/apache/harmony/javax/security/auth/login/Configuration;
    //   14: ifnonnull +9 -> 23
    //   17: invokestatic 40	org/apache/harmony/javax/security/auth/login/Configuration:getDefaultProvider	()Lorg/apache/harmony/javax/security/auth/login/Configuration;
    //   20: putstatic 37	org/apache/harmony/javax/security/auth/login/Configuration:configuration	Lorg/apache/harmony/javax/security/auth/login/Configuration;
    //   23: getstatic 37	org/apache/harmony/javax/security/auth/login/Configuration:configuration	Lorg/apache/harmony/javax/security/auth/login/Configuration;
    //   26: astore_3
    //   27: ldc 2
    //   29: monitorexit
    //   30: aload_3
    //   31: astore_1
    //   32: goto +11 -> 43
    //   35: astore_2
    //   36: ldc 2
    //   38: monitorexit
    //   39: aload_2
    //   40: athrow
    //   41: aload_0
    //   42: astore_1
    //   43: aload_1
    //   44: areturn
    //
    // Exception table:
    //   from	to	target	type
    //   11	39	35	finally
  }

  public static Configuration getConfiguration()
  {
    SecurityManager localSecurityManager = System.getSecurityManager();
    if (localSecurityManager != null)
      localSecurityManager.checkPermission(GET_LOGIN_CONFIGURATION);
    return getAccessibleConfiguration();
  }

  private static final Configuration getDefaultProvider()
  {
    return new Configuration()
    {
      public AppConfigurationEntry[] getAppConfigurationEntry()
      {
        return new AppConfigurationEntry[0];
      }

      public void refresh()
      {
      }
    };
  }

  public static void setConfiguration(Configuration paramConfiguration)
  {
    SecurityManager localSecurityManager = System.getSecurityManager();
    if (localSecurityManager != null)
      localSecurityManager.checkPermission(SET_LOGIN_CONFIGURATION);
    configuration = paramConfiguration;
  }

  public abstract AppConfigurationEntry[] getAppConfigurationEntry(String paramString);

  public abstract void refresh();
}